package com.milhouz.quizzdroid.bean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import android.database.Cursor;

import com.milhouz.quizzdroid.db.QuizzDroidConstants;

public class ResponseList {

	private final List<Response> mResponses = new ArrayList<Response>();

	public ResponseList(final Cursor cursor) {
		if (cursor != null) {
			String response = null;
			int index = 0;
			while (cursor.moveToNext()) {
				response = cursor.getString(cursor.getColumnIndex(QuizzDroidConstants.COLUMN_NAME_RESPONSE));
				mResponses.add(new Response(index, response));
				index++;
			}
			Collections.shuffle(mResponses);
		}
	}

	public int size() {
		return mResponses.size();
	}

	public Response get(int position) {
		return mResponses.get(position);
	}
}
